<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 100px;
            height: 100px;
            background-color: aqua;
        }
    </style>
</head>

<body>
    <div class="box" data-haha="5"></div>
    <script>
        let box = document.querySelector('.box');
        box.addEventListener('click', function(e) {
            console.log(e.target); // 当前的<div class="box"></div>
            console.log(e.type); // click
            console.log(e.target.dataset); // DOMStringMap {haha: '5'}
        })
    </script>
</body>

</html>